package com.dongdongshop.controller;

import com.dongdongshop.data.Result;
import com.dongdongshop.service.GoodsService;
import com.dongdongshop.vo.GoodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("goods")
public class GoodsController {

    @Autowired
    private GoodsService gs;

    @PostMapping("selectListByName")
    public Result selectListByName(){
        List<GoodsVO> volist = gs.selectListByName();
        return Result.OK().setData(volist);
    }

    //审核通过
    @PostMapping("updateStatus1")
    public Result updateStatus1(Long[] ids){
        gs.updateStatus1(ids);
        return Result.OK();
    }

    //审核驳回
    @PostMapping("updateStatus2")
    public Result updateStatus2(Long[] ids){
        gs.updateStatus2(ids);
        return Result.OK();
    }

    //商品表
    @PostMapping("addGoods")
    public Result addGoods(GoodsVO goodsVO){
        gs.addGoods(goodsVO);
        return Result.OK();
    }

}
